-- ariship_skill
-- created by panyl
-- 遗迹建筑功能-秘宝

return {
    canDevelop = function(id)
        local cond = SkyRelicFunctionM.query(id, "condition");
        local skillId = cond["skill_id"];

        return not SkyShipSkillM.hasOwn(skillId);
    end,

    limitDevelopDesc = function(id)
        local cond = SkyRelicFunctionM.query(id, "condition");

        -- 如果配置了要求某些冈布奥已觉醒，则遍历一下，判断是否都已觉醒
        local awakeSlime = cond["awake_slime"];
        if type(awakeSlime) == "table" and #awakeSlime > 0 then
            for _, petId in ipairs(awakeSlime) do
                if not AwakeM.isCarved(petId) then
                    local petStr = "";
                    for _, id in ipairs(awakeSlime) do
                        if string.len(petStr) > 0 then
                            petStr = getLocStr("seperator") .. PetM.query(id, "short_name");
                        else
                            petStr = PetM.query(id, "short_name");
                        end
                    end
                    return string.format(getLocStr("awake_carved_limit"), SkyRelicFunctionM.query(id, "name"), petStr);
                end
            end
        end

        return "";
    end
};
